// middleware/logger.js
module.exports = async (ctx, next) => {
    const start = new Date();
    await next(); // 使用 await 而不是 yield
    const ms = new Date() - start;
    console.log(`${ctx.method} ${ctx.url} - ${ms}ms`);
};